let gg:5=5
//联合
let id: string | number = "abc123";
let arr5:(string|number)[]=[56,66,"ss","yy"]
let pp:55|string="zs"
id = 123;
//interface可以继承extends
interface Per{
    name:string,
    age:number
}
//type起别名,与interface作用很相像
type kk={
    name:string,
    age:number
}
let ll:kk={
    name:"zs",
    age:23
}

//交叉：&(同时都要有)
type ppp1=kk&{id:number}
let lll:ppp1={
    name:"zs",
    age:23,
    id:1
}

//断言 as
let e1:unknown=56.66666
// if(typeof e1 ==="number"){//类型缩小
//     console.log(e1.toFixed(2))//保留两位小数
// }
console.log((e1 as number).toFixed(2))
let kkk: string | number = "abc123";
console.log(kkk.length)
function get1():string|number{
    return "zs"
}
let res6=get1()